<template>
  <el-upload
    action="#"
    :show-file-list="false"
    :http-request="submitUpload"
    auto-upload="true">
    <el-button type="" icon="Plus" size="mini"></el-button>
  </el-upload>
  <el-image :src="url"></el-image>
</template>

<script setup>

import { inject, ref } from 'vue'

const axios = inject('$axios')

const url = ref('')

const submitUpload = (f) => {
  const file = f.file
  const form = new FormData()
  form.append('file', file)
  axios.post('logic/tools/upload', form).then((res) => {
    console.log(res.data.msg)
    url.value = 'http://127.0.0.1:9000/team08/' + res.data.msg
  })
}
</script>

<style scoped>

</style>
